export default {
  //文章分类
  loadArticleItemServer(callback) {
    Vue.http.get(   '/article/listcategory.json?fields=id,name').then(function (response) {
      callback(response.data);
    });
  },
  //文章分类第二级
  loadNextArticleItemServer(callback) {
    Vue.http.get(   '/article/healthDietType.json').then(function (response) {
      callback(response.data);
    });
  },
  //文章列表
    loadArticleListServer(params, callback) {
        Vue.http.get(   '/article/listpage.json', { params: params }).then(function(response) {
            callback(response.data);
        });
    },
  // 保存发布文章 --保存或者保存并发布
  addArticleServer(params, callback_success, callback_error) {
      Vue.http.post(   '/article/add.json', params).then(response => {
          callback_success(response.data);
      }, response => {
          callback_error(response.data)
      });
  },
  //文章详情
  loadArticleDetail(params, callback) {
    Vue.http.get(   '/article/detail.json', { params: params }).then(function(response) {
      callback(response.data);
    });
  },
  // 修改文章--发布
  editArticleServer(params, callback_success, callback_error) {
      Vue.http.put(   '/article/modify.json', params).then(response => {
          callback_success(response.data);
      }, response => {
          callback_error(response.data)
      });
  },
  //文章列表-- 置顶，取消置顶
  topOrUnTopServer(params, callback_success, callback_error) {
    Vue.http.put(   '/article/top.json', params).then(response => {
      callback_success(response.data);
    }, response => {
      callback_error(response.data)
    });
  },
  // 文章列表--发布
  publishArticleServer(params, callback) {
    Vue.http.put(   '/article/publish.json', params).then(response => {
      callback(response.data);
    });
  },
  //文章列表--撤回
  revokeArticle(params, callback) {
    Vue.http.put(   '/article/revoke.json', params).then(response => {
      callback(response.data);
    });
  },
  //文章列表-- 删除文章
  deleteArticleServer(params, callback) {
    Vue.http.delete(   '/article/delete.json',  { params: params }).then(response => {
      callback(response.data);
    });
  },
  //文章列表--上架
  enableArticle(params, callback) {
    Vue.http.put(   '/article/enable.json', params).then(response => {
      callback(response.data);
    });
  },
  //文章列表--下架
  disableArticle(params, callback) {
    Vue.http.put(   '/article/disable.json', params).then(response => {
      callback(response.data);
    });
  },
}
